package com.hmdp.utils;

import java.util.Objects;

public class EqualsAndHashcode {
    public static void main(String[] args) {
        people people1 = new people();
        people people = new people();

        System.out.println(people.equals(people1));
    }
}

class people{
    private String name;
    private int age;

    public people(){
        name = "李华";
        age = 18;
    }

    @Override
    public boolean equals(Object obj) {
        if(this == obj){
            return true;
        }
        if (obj==null){
            return false;
        }
        if(getClass() != obj.getClass()){
            return false;
        }
        people other = (people) obj;
        return Objects.equals(name,other.name)
                &&age == other.age;
    }
}
